import {defineStore} from "pinia"
import * as api from "../api/users"
export const useUser =defineStore('users',{
    state(){
        return{
             shopping:"哈哈哈" ,
             cars:[],
             aa:false,
             kkk:0
        }
    },
    getters:{
        allpro(state){
            return state.cars.forEach(i=>{
                console.log(i.num * i.price)
                return  state.kkk+=(i.num * i.price)
                  
            })
            
        }
    },
    actions:{
        async all_data(){
            await api.shoppingApi()
            .then(res=>{
                this.shopping=res.data.data
            })
        }
    }
})

